<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<jsp:include page="/WEB-INF/jsp/common/_head.jsp"/>
<%@ include file="/WEB-INF/jsp/common/_includes.jsp" %>
<div class="ui grid">
    <div class="row">
        <div class="column">
            <div class="ui two column grid">
                <div class="three wide column">
                    <jsp:include page="/WEB-INF/jsp/common/_sidebar.jsp">
                        <jsp:param name="index" value="2201"/>
                    </jsp:include>
                </div>
                <div id="container" class="thirteen wide column">
                    <ol class="breadcrumb">
						<li><a href="/">后台管理</a></li>
						<li class="active">项目列表</li>
					</ol>
<!--                     <ul class="nav nav-pills" role="tablist"> -->
<!--                         <li role="presentation" class="active"><a href="/datadictionary/add">录入字典数据</a></li> -->
<!--                     </ul> -->
					<form class="" role="search">
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <div class="clearfix">
                                <div class="form-group w500 pull-left">
                                    <input type="text" class="form-control" name="kw" value="${not empty param.kw ? param.kw : ''}" placeholder="请输入项目名称">
                                </div>
                                <button type="submit" class="btn btn-default ml10">搜索</button>
                                </div>
                                <div class="mt5 pull-left">
                                    <span>状态：</span>
                                    <a class="btn btn-${empty param.editStatus || param.editStatus == -2 ? 'success':'default'}" value="-2" href="/project?kw=${param.kw}&&editStatus=-2">全部</a>
                                    <a class="btn btn-${param.editStatus == 1 ? 'success' :'default'}"  href="/project/?kw=${param.kw}&editStatus=1">审核中</a>
                                    <a class="btn btn-${param.editStatus == 2 ? 'success' :'default'}"  href="/project/?kw=${param.kw}&editStatus=2">审核通过</a>
                                    <a class="btn btn-${param.editStatus == -1 ? 'success' :'default'}"  href="/project/?kw=${param.kw}&editStatus=-1">审核拒绝</a>
                                </div>
                            </div>
                        </div>
                    </form>
                    <table class="table table-hover">
                        <thead>
                        <tr>
                        	<th>ID</th>
                            <th>项目名称</th>
                            <th>项目所在城市</th>
                            <th width="10%">所属阶段</th>
                            <th>团队人数</th>
                            <th>目标金额</th>
                            <th>募集天数（天)</th>
                            <th>项目类型</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${paginate.pageList}" var="project">
                            <tr>
                            	<td>${project.id}</td>
                                <td><a href="/project/${project.id}/more" target="_blank">${project.projectName}</a></td>
                                 <td>${project.projectProvince}.${project.projectCity}</td>
                                <td>
                              
                                <c:choose>
                                      <c:when test="${project.projectStage==1}">概念阶段</c:when>
                                      <c:when test="${project.projectStage==2}">研发中</c:when>
                                      <c:when test="${project.projectStage==3}">产品已发布</c:when>
                                      <c:when test="${project.projectStage==4}">产品已盈利</c:when>
                                </c:choose>
                                </td>
                                <td>${project.projectTeamCount}</td>
                                <td>${project.amount}</td>
                                <td>${project.collectDays}</td>
                                <td>
                                      <c:choose>
                                      <c:when test="${project.projectType==0}">产品众筹</c:when>
                                      <c:when test="${project.projectType==1}">股权众筹</c:when>
                                      </c:choose>
                                </td>
                                <td>
                                	<c:choose>
                                	<c:when test="${project.editStatus==-1 }">
	                                    <a class="btn active btn-success" isAudit="false" label="确认继续此操作？" title="审核" ref="/project/approval/${project.id}/2" href="javaScript:;">审核通过</a>
                                	</c:when>
                                	<c:when test="${project.editStatus==2 }">
                                		<a class="btn active btn-warning" isAudit="false" label="确认继续此操作？" title="审核" ref="/project/approval/${project.id}/-1" href="javaScript:;">审核不通过</a>
                                	</c:when>
                                	<c:otherwise>
                                		<a class="btn active btn-success" isAudit="false" label="确认继续此操作？" title="审核" ref="/project/approval/${project.id}/2" href="javaScript:;">审核通过</a>
                                		<a class="btn active btn-warning" isAudit="false" label="确认继续此操作？" title="审核" ref="/project/approval/${project.id}/-1" href="javaScript:;">审核不通过</a>
                                	</c:otherwise>
                                	</c:choose>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                    <div class="page-info clearfix">
                         <jsp:include page="/WEB-INF/jsp/common/_page.jsp"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="/WEB-INF/jsp/common/_foot.jsp"></jsp:include>
<script type="text/javascript">
	$(function(){
		$('a.btn-success,a.btn-warning').click(function(){
			var obj = $(this);
			var isAudit = obj.attr("isAudit");
			var title = obj.attr("title");
			var label = obj.attr("label");
			Confirm(title, label, function(){
				 $('#js_submit').button('loading');
				 $.get(obj.attr("ref"), {isAudit:isAudit}, function(res){
					$('#js_submit').button('reset');
					if(res.status == 'ok'){
						success(res.message);
						setTimeout(window.location.reload(),1000);
					}else{
						error(res.message);
						setTimeout(window.location.reload(),1000);
					}
				}); 
			});
		});
	});
</script>
